import React, { useEffect, useState, useMemo } from "react"
import { Table, Button, Space, Input, ImgDefault, Icon, message, Modal, Form, Radio, Checkbox, InputNumber, Spin, Select, Progress, Tag } from '@bytedance/mona-ui';
import type { ColumnProps } from '@bytedance/mona-ui/es/components/table';
import { getProdectList } from "@Api/productApi"
import db from "@tools/indexDB";
import { useAppSelector } from "~store"
import { setProductStatus, setProductStatusOnDange, batchLaunchProduct } from "@Api/productApi"
import { get__token } from '@Utils/getPageDecrypt'
import { get_lid } from "@Utils/getPageDecrypt"
import {
    getPayJifengList,
    getPayCode,
    getPayResult,
    getJifeng,
    getJiance,
    getJianceList,
    getJianceResult,
    getJianceScore,
    getJianceHistory
} from '@Api/sysApi/jianceProdectApi'
import moment from 'moment';
let batchId = ''
let isSaveJianceRsult = true
let xiaohaodefangejifen = 0 // 默认需要消耗的积分
function AiWeiguiJianCe(props) {
    const { active } = props
    if (!active) return null
    const shop_id = useAppSelector((state) => state.jinritemaiShops.userShopId)
    const jianceGoodsId = useAppSelector((state) => state.funcTabs.jianceGoodsId)
    useMemo(() => {
        getJifengFunc()
        getXiaohaoJifenFanc()
        setTimeout(() => {
            getProdectInfo()
        }, 1)
    }, [active])
    function getXiaohaoJifenFanc() {
        getJianceScore().then(res => {
            const numse = res.list.find(item => item.type === 'jiance')
            if (numse) {
                xiaohaodefangejifen = numse.num
            }
        })
    }
    function getJifengFunc() {
        return new Promise((resolve, reject) => {
            getJifeng().then(res => {
                let reter = (res.jianceScore + res.jianceSendScore) || 0
                // console.log('疾风', res)
                setJifengshengyu(reter)
                resolve(reter)
            }).catch(err => {
                reject(false)
            })
        })

    }
    const [jifengshengyu, setJifengshengyu] = useState(0)
    const columnsJianceTitle: ColumnProps<any>[] = [
        {
            title: '商品信息',
            key: 'info',
            width: 300,
            render: (text, record, index) => {
                return (
                    <Space direction="vertical">
                        <Space>
                            <ImgDefault
                                imgSrc={(() => {
                                    const imgae = record.img?.replace("obj/", "")
                                    return imgae + "~110x110_q75.image"
                                })()}
                                mask={false}
                                width={60}
                                height={60}></ImgDefault>
                            <Space direction="vertical" size={4}>
                                <div
                                    className="title"
                                    style={{
                                        fontSize: 12,
                                        color: "#252931"
                                    }}>
                                    {record.name}
                                </div>
                                <div
                                    className="isduer"
                                    style={{
                                        color: "#898b8f",
                                        fontSize: 12
                                    }}>
                                    ID:{record.product_id}
                                    <Icon
                                        type="CopyIcon"
                                        className="copyiconitem"
                                        style={{
                                            marginLeft: 5,
                                            cursor: "pointer"
                                        }}
                                        onClick={() => copyToClipboard(record.product_id)}
                                    />
                                </div>
                            </Space>
                        </Space>

                    </Space>
                )
            }
        },
        {
            title: '违规预测结果',
            key: 'weiguo',
            render: (text, record, index) => {
                return <Spin spinning={record.jianceItemLodin}>
                    <Space>
                        <Tag.Status type={!record.jianceResult ? "cancel" : record.jianceResult.jianceTextStatus === 1 ? 'success' : record.jianceResult.jianceTextStatus === 2 ? 'error' : record.jianceResult.jianceTextStatus === 3 ? 'warn' : "default"}></Tag.Status>
                        {
                            // if(!record.jianceResult) return '/'
                            (() => {
                                if (!record.jianceResult) return '/'
                                if (record.jianceResult.jianceTextStatus === 1) return record.jianceResult.jiancetext
                                if (record.jianceResult.jianceTextStatus === 2) {
                                    return <Space direction="vertical">
                                        <span>{record.jianceResult.jiancetext}</span>
                                        <Button type="link" onClick={() => {
                                            setWeiguiTabList(record.jianceResult.FullMsgList)
                                            setLockWeiguiLicone(record)
                                            setJianceXiangqing(true)
                                        }}>查看详情</Button>
                                        {/* {record.jianceResult.FullMsgList.map((item, index) => {
                                            return <span key={index}>{item.Reason1}</span>
                                        })} */}

                                    </Space>
                                }
                            })()

                        }
                    </Space>


                </Spin>
            }
        },
        {
            title: '品牌预测结果',
            key: 'pinpai',
            render: (text, record, index) => {
                return <Spin spinning={record.jianceItemLodin}>
                    <Tag.Status
                        type={!record.jianceResult ? "cancel" : record.jianceResult.jiancepingppaistatus === 1 ? 'success' : record.jianceResult.jiancepingppaistatus === 2 ? 'error' : record.jianceResult.jiancepingppaistatus === 3 ? 'warn' : "default"}>{record.jianceResult && record.jianceResult.jiancePingpaitext || '/'}</Tag.Status>
                </Spin>
            }
        },
        {
            title: '检测时间',
            key: 'CheckTime',
            render: (text, record, index) => {
                return <span>{record.CheckTime || '/'}</span>
            }
        },
        {
            title: '状态',
            key: 'tab',
            dataIndex: 'tab',
            width: 100,
            render: (text, record, index) => {
                return <Tag type={text == "售卖中" ? "default" : "warn"}>{text}</Tag>
            }
        },
        {
            title: '操作',
            key: 'caozuo',
            render: (text, record, index) => {
                return <Spin spinning={record.removedLodin || record.upProdetLodin || record.jianceItemLodin}>
                    <Space>
                        <Button type="link" icon={<Icon type="AiDrawIcon"></Icon>} onClick={async () => {

                            // record.jianceItemLodin = true
                            // setData([...data])
                            const jiancejifengstatus = await jianceJifengFunc(1)
                            if (!jiancejifengstatus) return
                            getJianceFunc({
                                NeedCheckLogo: checkConfig.pingpai,
                                ItemId: record.product_id, // '3663214583767786534', //
                                ImgUrl: record.img, //'https://p3-aio.ecombdimg.com/obj/ecom-shop-material/XQvFyMgl_m_6fdec1edadf93e75f991d8295bba3268_sx_107625_www800-800' //
                            }).then((res) => {
                                message.success('检测完成')
                                // record.jianceItemLodin = false
                                // setData([...data])
                            })
                        }}>{record.CheckTime ? '重新检测' : '开始检测'}</Button>
                        {record.tab == "售卖中" && <Button type="link" disabled={record.removedStatus} icon={<Icon type="DeclineIcon"></Icon>}
                            onClick={() => {
                                setProductStatusFunc([record.product_id])
                            }}
                        >下架</Button>}

                        {record.tab == "已下架" && <Button type="link" disabled={record.upProdetStatus} icon={<Icon type="RiseIcon"></Icon>} onClick={() => {
                            setUpErrorList([])
                            upErrorList = []
                            // onSale(record.product_id)
                            batchLaunchProductFun([record.product_id])
                        }}>上架</Button>}
                    </Space>
                </Spin>
            }
        }
    ]
    function copyToClipboard(text) {
        navigator.clipboard
            .writeText(text)
            .then(function () {
                message.success("复制成功")
            })
            .catch(function (err) {
                message.error("复制失败")
            })
    }
    const refoData = {
        page: 1,
        pageSize: 20,
        total: 0,
        shearType: 0,
        name: jianceGoodsId
    }
    const [shearQuery, setShearQuery] = useState(refoData)

    const [loading, setLoading] = useState(false)
    const [data, setData] = useState([])

    const [checkConfig, setCheckConfig] = useState({
        pingpai: true
    })

    function getProdectInfo() {
        setLoading(true)
        const shearDataAlls = {}
        switch (shearQuery.shearType) {
            case 0:
                shearDataAlls['check_status'] = ''
                break;
            case 1:
                shearDataAlls['check_status'] = 3
                shearDataAlls['status'] = 0
                shearDataAlls['has_stock'] = 1
                shearDataAlls['order_field'] = 'audit_time'
                shearDataAlls['is_online'] = 1
                break;
            case 2:
                shearDataAlls['order_field'] = 'offline_time'
                shearDataAlls['is_online'] = ''
                shearDataAlls['is_offline'] = 1
                break;
            default:
                break;
        }
        const shearDater = {
            page: shearQuery.page - 1,
            pageSize: shearQuery.pageSize,

            id_name_code: shearQuery.name,
            business_type: 4,
            is_online: 1,
            not_for_sale_search_type: 1,
            ...shearDataAlls
        }
        getProdectList(shearDater).then((res: any) => {
            console.log(res)
            setLoading(false)
            if (!res.code) {
                setShearQuery({
                    ...shearQuery,
                    total: res.total
                })
                // 先获取数据库的商品
                db.prodectlist.where(['product_id', 'shop_id'])
                    .anyOf(res.data.map(item => [item.product_id, shop_id]))
                    .toArray().then((resdate: any) => {
                        // console.log(resdate)

                        const getFormtData = res.data.map(items => {
                            // items.id = items.product_id
                            const getJianceData = resdate.find(itemser => {
                                return itemser.product_id === items.product_id
                            })
                            if (getJianceData && isSaveJianceRsult) {
                                items.CheckTime = getJianceData.CheckTime
                                items.jianceResult = getJianceData.jianceResult
                            }
                            items.removedStatus = false
                            items.removedLodin = false
                            items.upProdetStatus = false
                            items.upProdetLodin = false
                            items.jianceItemLodin = false
                            items.shop_id = shop_id
                            return items
                        })
                        setData(getFormtData)
                        db.prodectlist.bulkPut(getFormtData).then((e) => {
                            // console.log('更新成功', e)
                        }).catch(err => {
                            console.log('失败', err)
                        })
                    })


                return
            }
            setLoading(false)
            message.error(res.msg)
        }).catch(err => {
            setLoading(false)
            console.log(err)
            message.error(err.msg)
        })
    }
    const [selectedRowKeys, setSelectedRowKeys] = useState<any[]>([]);
    const onSelectChange = (newSelectedRowKeys: React.Key[]) => {
        // console.log('selectedRowKeys changed: ', selectedRowKeys);
        setSelectedRowKeys(newSelectedRowKeys);
    };
    const rowSelection = {
        preserveSelectedRowKeys: true,
        selectedRowKeys,
        onChange: onSelectChange,
        getCheckboxProps: (record) => ({
            disabled: record.deleteStatus, // Column configuration not to be checked
            name: record.product_id,
        }),
        selections: [
            // Table.SELECTION_ALL,
            Table.SELECTION_INVERT,
            Table.SELECTION_NONE
        ]
    };

    const [clearRedows, setClearRedows] = useState<any>(0)
    const [upProdectRwdows, setUpProdectRwdows] = useState<any>(0)
    let [upErrorList, setUpErrorList] = useState<any>([])
    const [upProdectErr, setupProdectErr] = useState(false)
    const [errProdectListcontent, setErrLointyer] = useState([])
    useEffect(() => {
        if (upErrorList && upErrorList.length) {
            // console.log('upErrorList', upErrorList)
            db.prodectlist.where(['product_id', 'shop_id'])
                .anyOf(upErrorList.map(item => [item.product_id, shop_id]))
                .toArray().then((resdate: any) => {
                    // console.log('resdate', resdate)
                    const upDATRAS = resdate.map((itemster) => {
                        const itemfin = upErrorList.find(item => item.product_id === itemster.product_id)
                        // console.log('itemfin', itemfin)
                        if (itemfin) {
                            itemster.fail_reason = itemfin.msg
                        }
                        return itemster
                    })
                    setErrLointyer(upDATRAS)
                })
            setupProdectErr(true)
            // alert('有上架错误的选项')
            return
        }
        setupProdectErr(false)
    }, [upErrorList])
    const errcoludata = [{
        title: '商品信息',
        key: 'info',
        width: 300,
        render: (text, record, index) => {
            return (
                <Space direction="vertical">
                    <Space>
                        <ImgDefault
                            imgSrc={(() => {
                                const imgae = record.img?.replace("obj/", "")
                                return imgae + "~110x110_q75.image"
                            })()}
                            mask={false}
                            width={60}
                            height={60}></ImgDefault>
                        <Space direction="vertical" size={4}>
                            <div
                                className="title"
                                style={{
                                    fontSize: 12,
                                    color: "#252931"
                                }}>
                                {record.name}
                            </div>
                            <div
                                className="isduer"
                                style={{
                                    color: "#898b8f",
                                    fontSize: 12
                                }}>
                                ID:{record.product_id}
                                <Icon
                                    type="CopyIcon"
                                    className="copyiconitem"
                                    style={{
                                        marginLeft: 5,
                                        cursor: "pointer"
                                    }}
                                    onClick={() => copyToClipboard(record.product_id)}
                                />
                            </div>
                        </Space>
                    </Space>

                </Space>
            )
        }
    }, {
        title: '失败原因',
        dataIndex: 'fail_reason',
        key: 'fail_reason',
    }]
    const upOrDowProdect = (type: number) => {
        if (selectedRowKeys.length === 0) {
            message.error("请选择商品")
            return
        }
        const typeText = type === 1 ? "下架" : "上架"
        let setList = []

        db.prodectlist.where(['product_id', 'shop_id'])
            .anyOf(selectedRowKeys.map(items => [items, shop_id])).toArray().then(res => {
                console.log('res', res)

                setList = res.filter(iytt => {
                    return type === 1 ? iytt.tab == "售卖中" : iytt.tab == "已下架"
                })
                console.log('setList', setList)
                if (setList.length === 0) {
                    message.error(`所选商品没有需要${typeText}的商品`)
                    return
                }
                setClearRedows(0)
                setUpProdectRwdows(0)
                setshangxiajiaDisabelStatus(true)
                type === 1 ? setProductStatusFuncAllState(setList, setList.length) : batchLaunchProductAllFun(setList, setList.length)

                // console.log('上下架的长', setList)

            }).catch(err => {
                console.log('err', err)
            })
        console.log('type', type) // 1下架 2 上架
    }
    // 批量下架
    function setProductStatusFuncAllState(ids, length) {
        const constcleterData = ids.splice(0, 2)
        setClearRedows(((length - ids.length) / length * 100).toFixed(2))

        if (!constcleterData || !constcleterData.length) {
            message.success('处理完成')
            setshangxiajiaDisabelStatus(false)
            setOutTimeGet()
            setClearRedows(100)
            return
        }
        setProductStatusFunc(constcleterData.map(item => item.product_id), (e) => {
            // console.log('e', e)
            setProductStatusFuncAllState(ids, length)
            // if (e) {
            //     setProductStatusFuncAllState(ids)
            // } else {
            //     message.error('处理失败')
            // }
        })
    }
    // 批量上架
    function batchLaunchProductAllFun(ids, length) {
        const constcleterData = ids.splice(0, 2)
        setUpProdectRwdows(((length - ids.length) / length * 100).toFixed(2))

        if (!constcleterData || !constcleterData.length) {
            message.success('处理完成')
            setshangxiajiaDisabelStatus(false)
            setOutTimeGet()

            setUpProdectRwdows(100)
            return
        }
        batchLaunchProductFun(constcleterData.map(item => item.product_id), (e) => {
            batchLaunchProductAllFun(ids, length)
        })
    }
    function setOutTimeGet() {
        setSelectedRowKeys([])
        setTimeout(() => {
            getProdectInfo()
        }, 2500)
    }

    // 上架
    function batchLaunchProductFun(ids, cb?) {
        if (!cheackBuyContent()) return
        setData((item) => {
            return item.map((item) => {
                if (ids.includes(item.product_id)) {
                    item.upProdetLodin = true
                }
                return item
            })
        })
        setWeiguiProdectListData((item) => {
            return item.map((item) => {
                if (ids.includes(item.product_id)) {
                    item.upProdetLodin = true
                }
                return item
            })
        })
        const searchParams = new URLSearchParams();
        searchParams.append('appid', '1');
        searchParams.append('__token', get__token().__token);
        searchParams.append('_bid', 'ffa_goods');
        searchParams.append('_lid', get_lid() + '');
        ids.forEach((id) => {
            searchParams.append('product_ids[]', id);
        })
        batchLaunchProduct(searchParams).then((res: any) => {
            if (!res.code) {
                // 这里过滤出上架失败的商品
                console.log('res', res.data)
                const errContern = res.data.filter((item) => {
                    return item.code !== 0
                })
                console.log('upErrorList', errContern, upErrorList)
                upErrorList.push(...errContern)
                console.log('upErrorList', errContern, upErrorList)
                setUpErrorList([...upErrorList])
                // setUpErrorList([...upErrorList.push(...errContern)])
                // setUpErrorList()
                console.log('errContern', errContern)
                setData((item) => {
                    return item.map((item) => {
                        if (ids.includes(item.product_id) && !errContern.find((item) => item.prodect_id === item.prodect_id)) {
                            item.upProdetStatus = true


                            // item.removedStatus = true
                            // item.removedLodin = false
                            item.tab = '售卖中'
                        }
                        item.upProdetLodin = false
                        return item
                    })
                })
                setWeiguiProdectListData((item) => {
                    return item.map((item) => {
                        if (ids.includes(item.product_id) && !errContern.find((item) => item.prodect_id === item.prodect_id)) {
                            item.upProdetStatus = true


                            // item.removedStatus = true
                            // item.removedLodin = false
                            item.tab = '售卖中'
                        }
                        item.upProdetLodin = false
                        return item
                    })
                })
                !cb && !upErrorList.length && message.success('上架成功')
                // !cb && setOutTimeGet()
                // 更新数据
                cb && cb(true)
            } else {
                message.error(res.msg)
                setData((item) => {
                    return item.map((item) => {
                        if (ids.includes(item.product_id)) {
                            // item.removedStatus = true
                            item.upProdetLodin = false
                        }
                        return item
                    })
                })
                setWeiguiProdectListData((item) => {
                    return item.map((item) => {
                        if (ids.includes(item.product_id)) {
                            // item.removedStatus = true
                            item.upProdetLodin = false
                        }
                        return item
                    })
                })
                cb && cb(false)
            }
        }).catch(err => {
            console.log('err', err)
            message.error('上架失败')
            setData((item) => {
                return item.map((item) => {
                    if (ids.includes(item.product_id)) {
                        // item.removedStatus = true
                        item.upProdetLodin = false
                    }
                    return item
                })
            })
            setWeiguiProdectListData((item) => {
                return item.map((item) => {
                    if (ids.includes(item.product_id)) {
                        // item.removedStatus = true
                        item.upProdetLodin = false
                    }
                    return item
                })
            })
            cb && cb(false)
        })
    }
    function setProductStatusFunc(ids: string[], cb?) {
        if (!cheackBuyContent()) return

        setData((item) => {
            return item.map((item) => {
                if (ids.includes(item.product_id)) {
                    item.removedLodin = true
                }
                return item
            })
        })
        setWeiguiProdectListData((item) => {
            return item.map((item) => {
                if (ids.includes(item.product_id)) {
                    item.removedLodin = true
                }
                return item
            })
        })
        // x-www-form-urlencoded
        const searchParams = new URLSearchParams();
        searchParams.append('appid', '1');
        searchParams.append('__token', get__token().__token);
        searchParams.append('_bid', 'ffa_goods');
        searchParams.append('_lid', get_lid() + '');
        ids.forEach((id) => {
            searchParams.append('product_ids[]', id);
        })
        setProductStatus(searchParams).then((res: any) => {
            if (!res.code) {
                !cb && message.success('下架成功')
                // const getListItem = data.filter((item) => {
                //     item.shop_id = shop_id
                //     item.type = 1 // 1下架 2删除
                //     console.log('item.shop_id', item.shop_id)
                //     item.clearTime = moment().format('YYYY-MM-DD HH:mm:ss')
                //     return ids.includes(item.product_id)
                // })
                // db.clearFlowLog.bulkAdd(getListItem).then((res) => {
                //     console.log('保存成功', res)

                // })
                setData((item) => {
                    return item.map((item) => {
                        if (ids.includes(item.product_id)) {
                            item.removedStatus = true
                            item.removedLodin = false

                            // item.upProdetStatus = true
                            // item.upProdetLodin = false
                            item.tab = '已下架'
                        }
                        return item
                    })
                })
                setWeiguiProdectListData((item) => {
                    return item.map((item) => {
                        if (ids.includes(item.product_id)) {
                            item.removedStatus = true
                            item.removedLodin = false

                            // item.upProdetStatus = true
                            // item.upProdetLodin = false
                            item.tab = '已下架'
                        }
                        return item
                    })
                })
                // !cb && setOutTimeGet()
                // 更新数据
                cb && cb(true)
                // initFun()
            } else {
                message.error(res.msg)
                setData((item) => {
                    return item.map((item) => {
                        if (ids.includes(item.product_id)) {
                            // item.removedStatus = true
                            item.removedLodin = false
                        }
                        return item
                    })
                })
                setWeiguiProdectListData((item) => {
                    return item.map((item) => {
                        if (ids.includes(item.product_id)) {
                            // item.removedStatus = true
                            item.removedLodin = false
                        }
                        return item
                    })
                })
                cb && cb(false)
            }
        }).catch(err => {
            message.error('下架失败')
            setData((item) => {
                return item.map((item) => {
                    if (ids.includes(item.product_id)) {
                        // item.removedStatus = true
                        item.removedLodin = false
                    }
                    return item
                })
            })
            setWeiguiProdectListData((item) => {
                return item.map((item) => {
                    if (ids.includes(item.product_id)) {
                        // item.removedStatus = true
                        item.removedLodin = false
                    }
                    return item
                })
            })
            cb && cb(false)
        })
    }
    const isBuyStatus = useAppSelector(
        (state) => state.jinritemaiProduct.isBuyStatus
    )
    function cheackBuyContent() {
        if (isBuyStatus.status) {
            // if (!show) {
            Modal.confirm({
                title: isBuyStatus.title,
                content: isBuyStatus.content,
                icon: null,
                okText: isBuyStatus.okText,
                cancelText: " 取消",
                onOk: () => {
                    open(isBuyStatus.url)
                    return
                }
            })
            return false
            // }

        }
        return true
    }

    // 上架当个商品
    function onSale(id: any) {
        setData((idser) => {
            return idser.map((iyter) => {
                if (iyter.product_id === id) {
                    iyter.upProdetLodin = true
                }
                return iyter
            })
        })
        const upData = {
            "product_id": id,
            "overwrite_pay_type": false,
            "appid": 1,
            "__token": get__token().__token,
            "_bid": "ffa_goods",
            "_lid": get_lid() + ''
        }
        setProductStatusOnDange(upData).then((res: any) => {
            console.log('res', res)
            if (!res.code) {
                message.success('商品提交审核成功，可在审核记录查看')
                setData((idser) => {
                    return idser.map((iyter) => {
                        if (iyter.product_id === id) {
                            iyter.upProdetStatus = true
                            iyter.upProdetLodin = false
                        }
                        return iyter
                    })
                })
                setOutTimeGet()
                return
            }
            message.error(res.msg)
            setData((idser) => {
                return idser.map((iyter) => {
                    if (iyter.product_id === id) {

                        iyter.upProdetLodin = false
                    }
                    return iyter
                })
            })
        }).catch(err => {
            console.log('上架失败', err)
            setData((idser) => {
                return idser.map((iyter) => {
                    if (iyter.product_id === id) {
                        iyter.upProdetLodin = false
                    }
                    return iyter
                })
            })
            message.error('上架失败')
        })
    }
    const [showRecharge, setshowRecharge] = useState(false)
    const [getListStatus, setGetListStatus] = useState(false)
    const [payGoods, setPayGoods] = useState<any>([])

    function openChongzhiApiListPage() {
        setshowRecharge(true)
        setGetListStatus(true)
        getPayJifengList().then((res: any) => {
            console.log('res0000', res)
            setGetListStatus(false)
            setPayGoods(res.list)

        })
    }
    let out_trade_no = "66fa6efaf7367f208a47cc4a"
    function getPayCodeFun(id) {
        getPayCode(id).then(res => {
            console.log('充值表单', res)
            if (!res.code) {
                out_trade_no = res.out_trade_no
                window.open(res.data)
                setTimeout(() => {
                    Modal.confirm({
                        title: '充值提示',
                        content: '充值成功后，请点击确认',
                        onOk() {
                            getPayResultFunc()
                        },
                        onCancel() {
                            // message.error('取消充值')
                        },
                        okText: '我已经充值',
                        cancelText: '取消',

                    })
                }, 1000)
            }
        })
    }
    function getPayResultFunc() {
        if (!out_trade_no) {
            message.error('请先充值')
            return
        }
        getPayResult(out_trade_no).then(res => {
            console.log('是否充值结果', res)
            if (res.status == 1) {
                message.success('充值成功')
                getJifengFunc()
                return
            }
            message.error('充值失败')

        }).catch(err => {
            console.log('是否充值结果err', err)
        })
    }
    // 单个商品检测
    async function getJianceFunc(upData) {
        const { ItemId } = upData
        console.log('upData', upData)
        console.log('data', data, [ItemId, shop_id])
        // upData.ImgUrl = 'https://static.nike.com.cn/a/images/t_PDP_864_v1/f_auto,b_rgb:f5f5f5/b7d9211c-26e7-431a-ac24-b0540fb3c00f/air-force-1-07-%E7%94%B7%E5%AD%90%E7%A9%BA%E5%86%9B%E4%B8%80%E5%8F%B7%E8%BF%90%E5%8A%A8%E9%9E%8B%E6%9D%BF%E9%9E%8B-bDMNfd.png'
        // const tiemList = await db.prodectlist.where(['product_id', 'shop_id'])
        // .equals([ItemId, shop_id]).toArray((res) => {
        //     console.log('eee', res)
        // })

        // console.log('数据库的结果', tiemList)
        // return

        let record = data.find(item => item.product_id == ItemId)
        // console.log('record', record)
        if (!record) {
            const tiemList = await db.prodectlist.where(['product_id', 'shop_id'])
                .equals([ItemId, shop_id]).toArray()
            // console.log('数据库的结果', tiemList)
            record = tiemList[0]
        }
        let weiguiItem
        if (weiguiProdectListData && weiguiProdectListData.length) {
            weiguiItem = weiguiProdectListData.find(item => item.product_id == ItemId)
        }
        if (!record) return
        record.jianceItemLodin = true
        if (weiguiItem) {
            weiguiItem.jianceItemLodin = true
            setWeiguiProdectListData([...weiguiProdectListData])
        }
        setData([...data])
        const redData = await getJiance(upData).catch(err => {
            // record.jianceItemLodin = true
            // console.log('err,', err)
            // setData([...data])
            console.log('err检测结果错误', err)
            if (err && err.code === 4893) {
                console.log('错误后的重试', upData)
                return getJianceFunc(upData)
            }
            return false
        })
        if (!redData) return
        console.log('redData', redData)
        const { result } = redData
        const jianceResult = {
            jiancetext: '',
            jianceTextStatus: 0,
            jiancePingpaitext: '',
            jiancepingppaistatus: 0,
            FullMsgList: []
        }
        if (!result.CheckLogoStatus) {
            jianceResult.jiancePingpaitext = '未开启品牌检测'
            jianceResult.jiancepingppaistatus = 3 // 3未开启 1正确 2 错误 4 检测失败
        } else {
            if (result.CheckLogoStatus == 1) {
                if (result.LogoMsg) {
                    jianceResult.jiancepingppaistatus = 2
                    jianceResult.jiancePingpaitext = result.LogoMsg
                } else {
                    jianceResult.jiancepingppaistatus = 1
                    jianceResult.jiancePingpaitext = '恭喜 品牌检测通过, 无异常'
                }

            } else {
                jianceResult.jiancepingppaistatus = 4
                jianceResult.jiancePingpaitext = result.LogoMsg
            }
        }
        if (result.Status) {
            jianceResult.jiancetext = '恭喜 检测通过, 无违规'
            jianceResult.jianceTextStatus = 1
        } else {
            // 过滤 result.FullMsgList 中Reason1 重复的项
            let filterReason1 = result.FullMsgList.filter((item: any, index: number, self: any) => {
                return self.findIndex((t: any) => t.Reason + t.Reason1 === item.Reason + item.Reason1) === index;
            })
            // console.log('filterReason1', filterReason1)
            jianceResult.FullMsgList = filterReason1
            jianceResult.jiancetext = result.Msg
            jianceResult.jianceTextStatus = 2
        }
        record.CheckTime = result.CheckTime
        record.jianceResult = jianceResult
        record.jianceItemLodin = false
        if (weiguiItem) {
            weiguiItem.CheckTime = result.CheckTime
            weiguiItem.jianceResult = jianceResult
            weiguiItem.jianceItemLodin = false
            setWeiguiProdectListData([...weiguiProdectListData])
        }
        // 保持检测结果
        isSaveJianceRsult && db.prodectlist.put(record).then((e) => {
            // console.log('更新成功00', e)
        }).catch(err => {
            console.log('数据失败', err)
        })
        setData([...data])
        getJifengFunc()
        return { result, record }

    }

    const [weiguiProdectList, setWeiguiProdectList] = useState(false)
    const [weiguiProdectListData, setWeiguiProdectListData] = useState<any>([])

    // 批量商品检测
    // function getJianceAllFunc() {
    //     getJianceList().then(res => {
    //         console.log('检测结果', res)
    //     })
    // }
    // let batchId = ''
    const [jianceAllRedows, setjianceAllRedows] = useState(0)
    const [piliangjianceStateStatus, setpiliangjianceStateStatus] = useState(false)

    // 检查积分是否足够使用
    function jianceJifengFunc(len = 1) {
        return new Promise(async (resolve, reject) => {
            if (!cheackBuyContent()) return resolve(false)
            const getJifengNow: any = await getJifengFunc().catch(err => false)
            if (getJifengNow && getJifengNow >= len * xiaohaodefangejifen) {
                if (len === 1) {
                    return resolve(true)
                }
                return Modal.confirm({
                    title: '确认检测',
                    content: `本次检测将消耗${len * xiaohaodefangejifen}积分，是否确认检测？`,
                    okText: '确认',
                    cancelText: '取消',
                    onOk() {
                        resolve(true)
                    }, onCancel() {
                        resolve(false)
                    }
                })

            }
            Modal.warning({
                title: '积分余额不足',
                content: `本次检测将消耗${len * xiaohaodefangejifen}积分, 您的积分余额不足，无法进行此次检测，是否前往充值？`,
                okText: '前往充值',
                cancelText: '取消',
                onOk() {
                    openChongzhiApiListPage()
                },
                onCancel() {
                    console.log('Cancel');
                },
            });
            return false
        })

    }
    // 批量检测
    const jianceAll = async () => {
        console.log(selectedRowKeys)
        if (selectedRowKeys.length === 0) {
            message.error("请选择商品")
            return
        }
        const jiancejifengstatus = await jianceJifengFunc(selectedRowKeys.length)
        if (!jiancejifengstatus) return
        const getProdectLikst = await db.prodectlist.where(['product_id', 'shop_id']).anyOf(selectedRowKeys.map(items => [items, shop_id])).toArray()
        console.log('getProdectLikst', getProdectLikst)
        setpiliangjianceStateStatus(true)
        // 递归调用 getJianceFunc 直到完成
        setjianceAllRedows(0)
        let intention = 0
        const getPuterListers = []
        const copyList = JSON.parse(JSON.stringify(getProdectLikst))
        while (copyList && copyList.length) {
            getPuterListers.push(copyList.splice(0, 20))
        }
        console.log('getPuterListers11154545', getPuterListers)
        jianceCbData(getPuterListers)
        let showErrKeys = []

        function jianceCbData(data) {
            const getCnIntwe = data.splice(0, 1)
            console.log('getCnIntwe', getCnIntwe)
            if (!getCnIntwe || !getCnIntwe.length) {
                setjianceAllRedows(100)
                setpiliangjianceStateStatus(false)

                if (showErrKeys.length) {
                    message.error("检测到有" + showErrKeys.length + "个商品不合格")
                    console.log('显示不合规的商品', showErrKeys)
                    setWeiguiProdectList(true)
                    setWeiguiProdectListData(showErrKeys)
                    return
                }
                Modal.success({
                    title: '检测完成',
                    content: '恭喜 所有商品都合格',
                    onOk: () => {
                        message.success
                    },
                })
                return
            }
            const mapterAll = getCnIntwe[0].map(res => {
                // console.log('res', res.product_id)
                return getJianceFunc({
                    ItemId: res.product_id,
                    ImgUrl: res.img,
                    NeedCheckLogo: checkConfig.pingpai
                }).then(res => {
                    intention++
                    console.log('intention', intention, getProdectLikst.length)
                    setjianceAllRedows(Number((intention / getProdectLikst.length * 100).toFixed(2)))
                    return res
                })
            })
            Promise.all(mapterAll).then(res => {
                // console.log('批量检测结果', res)
                res.forEach((item) => {
                    console.log('item', item, item.result)
                    if (item.result.Status === 0) {
                        console.log('item.record', item.record)
                        showErrKeys.push(item.record)
                    }
                })
                jianceCbData(data)

            })
        }



        // function jianceCbFunc() {
        //     const getLiter = getProdectLikst
        // }
        // return
        // getJianceList(getProdectLikst.map(res => {
        //     return {
        //         ItemId: res.product_id,
        //         ImgUrl: res.img,
        //         NeedCheckLogo: checkConfig.pingpai
        //     }
        // })).then((res) => {
        //     console.log('检测全部结果', res)
        //     batchId = res.batchId
        //     getJifengFunc()

        //     setTimeout(() => {
        //         getJianceListAll()
        //     }, 2000)
        // })
    }
    // 检测所有的结果
    function getJianceListAll() {
        getJianceResult(batchId).then(res => {
            // console.log('测试的结果, res', res)
            getJifengFunc()
        })


    }
    const [jianceXiangqing, setJianceXiangqing] = useState<any>(false)
    const [lockWeiguiLicone, setLockWeiguiLicone] = useState<any>(null)
    const [weiguiTabList, setWeiguiTabList] = useState<any>([])
    const [shangxiajiaDisabelStatus, setshangxiajiaDisabelStatus] = useState(false)
    const weiguiTabListColums = [{
        title: '违规类型',
        dataIndex: 'TypeStr',
        key: 'TypeStr',
        width: 100
    },
    {
        title: '违规内容',
        dataIndex: 'Reason',
        key: 'Reason',
    },
    {
        title: '违规详情',
        dataIndex: 'Reason1',
        key: 'Reason1',
    }
    ]
    const [showJianceHistory, setShowJianceHistory] = useState(false)
    const [jianceHistory, setJianceHistory] = useState<any>([])
    const [getJianceHistoryQuery, setGetJianceHistoryQuery] = useState<any>({
        page: 1,
        pageSize: 20,
        total: 0,
        ItemId: '',
        cheackStatus: ''
    })
    const [getHistoreyLoding, setGetHistoreyLoading] = useState(false)
    function getJianceLogsList() {
        setGetHistoreyLoading(true)
        getJianceHistory({ page: getJianceHistoryQuery.page, pageSize: getJianceHistoryQuery.pageSize, ItemId: getJianceHistoryQuery.ItemId, cheackStatus: getJianceHistoryQuery.cheackStatus }).then(res => {
            setGetHistoreyLoading(false)
            setJianceHistory(res.list.map(item => {
                const result = item.api_response_data
                item.img = item.api_request_data.ImgUrl
                item.product_id = item.api_request_data.ItemId
                const jianceResult = {
                    jiancetext: '',
                    jianceTextStatus: 0,
                    jiancePingpaitext: '',
                    jiancepingppaistatus: 0,
                    FullMsgList: []
                }
                if (!result.CheckLogoStatus) {
                    jianceResult.jiancePingpaitext = '未开启品牌检测'
                    jianceResult.jiancepingppaistatus = 3 // 3未开启 1正确 2 错误 4 检测失败
                } else {
                    if (result.CheckLogoStatus == 1) {
                        if (result.LogoMsg) {
                            jianceResult.jiancepingppaistatus = 2
                            jianceResult.jiancePingpaitext = result.LogoMsg
                        } else {
                            jianceResult.jiancepingppaistatus = 1
                            jianceResult.jiancePingpaitext = '恭喜 品牌检测通过, 无异常'
                        }

                    } else {
                        jianceResult.jiancepingppaistatus = 4
                        jianceResult.jiancePingpaitext = result.LogoMsg
                    }
                }
                if (result.Status) {
                    jianceResult.jiancetext = '恭喜 检测通过, 无违规'
                    jianceResult.jianceTextStatus = 1
                } else {
                    // 过滤 result.FullMsgList 中Reason1 重复的项
                    let filterReason1 = result.FullMsgList.filter((item: any, index: number, self: any) => {
                        return self.findIndex((t: any) => t.Reason + t.Reason1 === item.Reason + item.Reason1) === index;
                    })
                    // console.log('filterReason1', filterReason1)
                    jianceResult.FullMsgList = filterReason1
                    jianceResult.jiancetext = result.Msg
                    jianceResult.jianceTextStatus = 2
                }
                // record.CheckTime = result.CheckTime
                item.jianceResult = jianceResult
                return item
            }))
            getJianceHistoryQuery.total = res.total
            setGetJianceHistoryQuery({ ...getJianceHistoryQuery })
        })
    }
    const historyColumns = [{
        title: '商品信息',
        key: 'prodect_info',
        render: (text: any, record: any) => {
            return (
                <Space direction="vertical">
                    <Space>
                        <ImgDefault
                            imgSrc={(() => {
                                const imgae = record.api_request_data.ImgUrl?.replace("obj/", "")
                                return imgae + "~110x110_q75.image"
                            })()}
                            mask={false}
                            width={60}
                            height={60}></ImgDefault>
                        <Space direction="vertical" size={4}>
                            {/* <div
                                className="title"
                                style={{
                                    fontSize: 12,
                                    color: "#252931"
                                }}>
                                {record.name}
                            </div> */}
                            <div
                                className="isduer"
                                style={{
                                    color: "#898b8f",
                                    fontSize: 12
                                }}>
                                ID:{record.api_request_data.ItemId}
                                <Icon
                                    type="CopyIcon"
                                    className="copyiconitem"
                                    style={{
                                        marginLeft: 5,
                                        cursor: "pointer"
                                    }}
                                    onClick={() => copyToClipboard(record.api_request_data.ItemId)}
                                />
                            </div>
                        </Space>
                    </Space>

                </Space>
            )
        }
    },
    {
        title: '违规预测结果',
        key: 'weiguo',
        render: (text, record, index) => {
            return <Space>
                <Tag.Status type={!record.jianceResult ? "cancel" : record.jianceResult.jianceTextStatus === 1 ? 'success' : record.jianceResult.jianceTextStatus === 2 ? 'error' : record.jianceResult.jianceTextStatus === 3 ? 'warn' : "default"}></Tag.Status>
                {
                    // if(!record.jianceResult) return '/'
                    (() => {
                        if (!record.jianceResult) return '/'
                        if (record.jianceResult.jianceTextStatus === 1) return record.jianceResult.jiancetext
                        if (record.jianceResult.jianceTextStatus === 2) {
                            return <Space direction="vertical">
                                <span>{record.jianceResult.jiancetext}</span>
                                <Button type="link" onClick={() => {
                                    setWeiguiTabList(record.jianceResult.FullMsgList)
                                    setLockWeiguiLicone(record)
                                    setJianceXiangqing(true)
                                }}>查看详情</Button>
                                {/* {record.jianceResult.FullMsgList.map((item, index) => {
                                        return <span key={index}>{item.Reason1}</span>
                                    })} */}

                            </Space>
                        }
                    })()

                }
            </Space>

        }
    },
    {
        title: '品牌预测结果',
        key: 'pinpai',
        render: (text, record, index) => {
            return <Tag.Status
                type={!record.jianceResult ? "cancel" : record.jianceResult.jiancepingppaistatus === 1 ? 'success' : record.jianceResult.jiancepingppaistatus === 2 ? 'error' : record.jianceResult.jiancepingppaistatus === 3 ? 'warn' : "default"}>{record.jianceResult && record.jianceResult.jiancePingpaitext || '/'}</Tag.Status>

        }
    },
    {
        title: '检测时间',
        key: 'CheckTime',
        render: (text, record, index) => {
            return <span>{record.api_response_data.CheckTime || '/'}</span>
        }
    },
    ]
    return <Space direction="vertical" style={{ width: '100%', padding: '10px 0' }}>
        <div className="retou" style={{
            width: '100%',
            display: 'flex',
            justifyContent: 'space-between',
            alignItems: 'center'
        }}>
            <Form size="small" layout="inline">
                <Form.Item label="商品状态">
                    <Radio.Group
                        disabled={loading} value={shearQuery.shearType} onChange={(e) => {
                            shearQuery.shearType = e.target.value
                            getProdectInfo()
                            setShearQuery({ ...shearQuery })
                        }}>
                        <Radio.Button value={0}>全部</Radio.Button>
                        <Radio.Button value={1}>售卖中</Radio.Button>
                        <Radio.Button value={2}>仓库</Radio.Button>
                        {/* <Radio.Button value={4}>D</Radio.Button> */}
                    </Radio.Group>
                </Form.Item>
                <Form.Item label="商品ID/商品名称">
                    <Input
                        placeholder="请输入商品名称/商品ID/商家编码，多条可用逗号隔开"
                        disabled={loading}
                        style={{
                            width: '400px'
                        }}
                        value={shearQuery.name}
                        onChange={(e) => {
                            setShearQuery({
                                ...shearQuery,
                                name: e.target.value
                            })
                        }}
                    ></Input>
                </Form.Item>
                <Form.Item noStyle>
                    <Space>
                        <Button loading={loading || shangxiajiaDisabelStatus} disabled={loading || shangxiajiaDisabelStatus} type="primary" icon={<Icon type="SearchIcon" />}
                            onClick={() => {
                                setClearRedows(0)
                                setUpProdectRwdows(0)
                                setjianceAllRedows(0)
                                setSelectedRowKeys([])
                                getProdectInfo()
                            }}
                        >查询</Button>
                        <Button loading={loading || shangxiajiaDisabelStatus} disabled={loading || shangxiajiaDisabelStatus} icon={<Icon type="RetryIcon" />} onClick={() => {
                            setClearRedows(0)
                            setUpProdectRwdows(0)
                            setjianceAllRedows(0)
                            setSelectedRowKeys([])
                            setShearQuery({
                                ...refoData,
                                total: shearQuery.total
                            })
                        }}>重置</Button>

                    </Space>
                </Form.Item>
            </Form>
            <Space size={4}>
                <span>剩余{jifengshengyu}积分</span>
                <Button size="mini" type="primary" onClick={openChongzhiApiListPage}>充值</Button>
                <Button size="mini" onClick={() => {
                    setShowJianceHistory(true)
                    getJianceLogsList()

                }}>检测历史</Button>
            </Space>
            {/* <Button onClick={() => {
                getJianceListAll('66fa818a5c074cadea65a569')
            }}>测试</Button> */}
        </div>

        <Table
            rowSelection={rowSelection}
            title={() => {
                return (<div style={{
                    display: 'flex',
                    justifyContent: 'space-between',
                    alignItems: 'center'
                }}>
                    <Space size={0}>
                        预检配置：
                        <Checkbox size="small" checked={true} disabled>知识产权</Checkbox>
                        <Checkbox size="small" checked={true} disabled>盗图</Checkbox>
                        <Checkbox size="small" checked={true} disabled>假冒商品</Checkbox>
                        <Checkbox size="small" checked={true} disabled>发布混淆信息</Checkbox>
                        <Checkbox size="small" checked={true} disabled>平台违禁信息</Checkbox>
                        <Checkbox size="small" checked={true} disabled>假货</Checkbox>
                        <Checkbox size="small" checked={true} disabled>劣质商品</Checkbox>
                        <Checkbox size="small" checked={checkConfig.pingpai} onChange={(e) => {
                            setCheckConfig({
                                ...checkConfig,
                                pingpai: e.target.checked
                            })
                        }}>品牌预检</Checkbox>
                        {!!selectedRowKeys.length && <Tag>已选择{selectedRowKeys.length}件商品</Tag>}
                    </Space>

                    <Space>
                        <Button loading={shangxiajiaDisabelStatus} disabled={shangxiajiaDisabelStatus} size="mini" icon={<Icon type="DeclineIcon"></Icon>} onClick={() => {
                            upOrDowProdect(1)
                        }}>下架</Button>
                        <Progress type="circle" width={25} percent={clearRedows} />
                        <Button loading={shangxiajiaDisabelStatus} disabled={shangxiajiaDisabelStatus} size="mini" icon={<Icon type="RiseIcon"></Icon>} onClick={() => {
                            setUpErrorList([])
                            upErrorList = []
                            upOrDowProdect(2)
                        }}>上架</Button>
                        <Progress type="circle" width={25} percent={upProdectRwdows} />
                        <Button loading={piliangjianceStateStatus} disabled={piliangjianceStateStatus} size="mini" icon={<Icon type="AiDrawIcon"></Icon>} type="primary" onClick={() => {
                            jianceAll()
                        }}>批量检测</Button>
                        <Progress type="circle" width={25} percent={jianceAllRedows} />
                    </Space>
                </div>)
            }}
            columns={columnsJianceTitle}
            loading={{
                spinning: loading || piliangjianceStateStatus,
                tip: piliangjianceStateStatus ? <>商品检测中 请勿关闭或刷新页面</> : <>加载中。。。</>
            }}
            dataSource={data}
            scroll={{ y: 900 }}
            rowKey="product_id"
            pagination={{
                total: shearQuery.total,
                showTotal: (total, range) => {
                    return `共 ${total} 件商品`
                },
                pageSizeOptions: ['10', '20'],
                pageSize: shearQuery.pageSize,
                onChange: (page, pageSize) => {
                    shearQuery.page = page
                    shearQuery.pageSize = pageSize
                    setShearQuery({
                        ...shearQuery,
                        page: page,
                        pageSize: pageSize
                    })
                    getProdectInfo()
                }
            }}
        >

        </Table>
        <Modal
            title="充值积分"
            visible={showRecharge}
            onOk={() => {

            }}
            onCancel={() => {
                setshowRecharge(false)
            }}
        >
            <Spin spinning={getListStatus}>
                <Space wrap>
                    {payGoods.map((item: any) => {
                        return <div className="itemPayBox" key={item._id}>
                            <Space direction="vertical" align="center">
                                <div className="names"> {item.name}</div>
                                <div className="mary">￥{item.price}</div>
                                <div className="jifen">
                                    <Space size={2}>

                                        {item.integral}
                                        <span className="jifengteste">积分</span>
                                    </Space>
                                </div>
                                {!!item.giveintegral && <div className="sonde">{item.giveintegral}</div>}
                                <Button type="primary" onClick={() => {
                                    getPayCodeFun(item._id)
                                }}>充值</Button>
                            </Space>

                        </div>
                    })}
                </Space>

            </Spin>
        </Modal>
        <Modal
            title="检测详情"
            visible={jianceXiangqing}
            width={800}
            footer={null}
            onCancel={() => {
                setJianceXiangqing(false)
            }}
            zIndex={9999999}
        >
            <Space direction="vertical">
                {lockWeiguiLicone && <Space direction="vertical">
                    <Space>
                        <ImgDefault
                            imgSrc={(() => {
                                const imgae = lockWeiguiLicone.img?.replace("obj/", "")
                                return imgae + "~110x110_q75.image"
                            })()}
                            mask={false}
                            width={60}
                            height={60}></ImgDefault>
                        <Space direction="vertical" size={4}>
                            <div
                                className="title"
                                style={{
                                    fontSize: 12,
                                    color: "#252931"
                                }}>
                                {lockWeiguiLicone.name}
                            </div>
                            <div
                                className="isduer"
                                style={{
                                    color: "#898b8f",
                                    fontSize: 12
                                }}>
                                ID:{lockWeiguiLicone.product_id}
                                <Icon
                                    type="CopyIcon"
                                    className="copyiconitem"
                                    style={{
                                        marginLeft: 5,
                                        cursor: "pointer"
                                    }}
                                    onClick={() => copyToClipboard(lockWeiguiLicone.product_id)}
                                />
                            </div>
                        </Space>
                    </Space>

                </Space>}
                <Table
                    columns={weiguiTabListColums}
                    dataSource={weiguiTabList}
                    pagination={false}
                ></Table>
            </Space>

        </Modal>

        <Modal
            title="违规商品列表"
            visible={weiguiProdectList}
            footer={null}
            onCancel={() => setWeiguiProdectList(false)}
            width={1200}

        >
            <Table columns={columnsJianceTitle} dataSource={weiguiProdectListData}></Table>


        </Modal>
        <Modal
            title="上架错误商品列表"
            visible={upProdectErr}
            footer={null}
            onCancel={() => setupProdectErr(false)}
        >
            <Table
                columns={errcoludata}
                dataSource={errProdectListcontent}
            ></Table>
        </Modal>
        <Modal
            title="违规检测历史"
            footer={null}
            visible={showJianceHistory}
            width={1100}
            onCancel={() => setShowJianceHistory(false)}
        >
            <Space direction="vertical" style={{
                width: "100%"
            }}>
                <Form layout="inline" size="small">
                    <Form.Item label="商品ID">
                        <Input style={{
                            width: 200
                        }} value={getJianceHistoryQuery.product_id} onChange={(e) => {
                            getJianceHistoryQuery.ItemId = e.target.value
                            setGetJianceHistoryQuery({
                                ...getJianceHistoryQuery,
                            })
                        }} placeholder="请输入商品ID" />
                    </Form.Item>
                    <Form.Item label="是否违规">
                        <Select value={getJianceHistoryQuery.cheackStatus} style={{
                            width: 100
                        }} onChange={(e) => {
                            getJianceHistoryQuery.cheackStatus = e
                            setGetJianceHistoryQuery({
                                ...getJianceHistoryQuery,
                            })
                        }}>
                            <Select.Option value={""}>全部</Select.Option>
                            <Select.Option value={1}>未违规</Select.Option>
                            <Select.Option value={0}>违规</Select.Option>
                        </Select>
                    </Form.Item>
                    <Form.Item noStyle>
                        <Button type="primary" onClick={() => {
                            // if (!getJianceHistoryQuery.ItemId) return
                            getJianceHistoryQuery.page = 1
                            setGetJianceHistoryQuery({
                                ...getJianceHistoryQuery,
                            })
                            getJianceLogsList()
                        }}> 查询</Button>
                    </Form.Item>
                </Form>
                <Table loading={getHistoreyLoding} columns={historyColumns} dataSource={jianceHistory} pagination={{
                    total: getJianceHistoryQuery.total,
                    showTotal: (total) => `共 ${total} 条`,
                    pageSize: getJianceHistoryQuery.pageSize,
                    current: getJianceHistoryQuery.page,
                    onChange: (page, pageSize) => {
                        getJianceHistoryQuery.page = page
                        getJianceHistoryQuery.pageSize = pageSize
                        setGetJianceHistoryQuery({
                            ...getJianceHistoryQuery,
                        })
                        getJianceLogsList()
                    }
                }}></Table>
            </Space>


        </Modal>

    </Space>
}

export default AiWeiguiJianCe